package niconama04.server;

import java.util.List;

import niconama04.client.RegistOriginalService;
import niconama04.model.impl.TransacterFactory;
import niconama04.shared.data.Category;
import niconama04.shared.data.CategoryOriginal;
import niconama04.shared.data.Original;
import niconama04.shared.data.Constants.Pos;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;


public class RegistOriginalServiceImpl extends RemoteServiceServlet implements RegistOriginalService {

	/** Serial Version */
	private static final long serialVersionUID = -7900122440192793959L;

	@Override
	public List<Original> getOriginals() throws Exception {
		return TransacterFactory.getInstance().getLoader().getOriginals(Pos.MEISHI);
	}

	@Override
	public List<Category> getCategorys() throws Exception {
		return TransacterFactory.getInstance().getLoader().getCategorys();
	}

	@Override
	public List<Original> getSubOriginals(Long x_categoryKey) throws Exception {
		return TransacterFactory.getInstance().getLoader().getOriginals(x_categoryKey);
	}

	@Override
	public List<Category> getSubCategorys(Long x_originalKey) throws Exception {
		return TransacterFactory.getInstance().getLoader().getCategorys(x_originalKey);
	}

	@Override
	public CategoryOriginal registCategoryOriginal(CategoryOriginal x_categoryOriginal) throws Exception {
		return TransacterFactory.getInstance().getTransacter().registCategoryOriginal(x_categoryOriginal);
	}

	@Override
	public void deleteCategoryOriginal(CategoryOriginal x_categoryOriginal) throws Exception {
		TransacterFactory.getInstance().getTransacter().deleteCategoryOriginal(x_categoryOriginal);
	}
}
